import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2022-12-15
 * Time: 11:09
 */
public class Test {
    public static void main(String[] args) {
//        String string = "abc";
//        String string2 = string.concat("def");
//        System.out.println(string.length());
//        System.out.println(string2);

        CharSequence sequence = "sdfs";
        String chars = "abc";
        StringBuffer stringBuffer = new StringBuffer(sequence);
        System.out.println(stringBuffer);
        Integer[] arr = {1, 6, 3, 4, 5};
        //匿名内部类,这样可以任意比较Object
//        Arrays.sort(arr, new Comparator() {
//            @Override
//            public int compare(Object o1, Object o2) {
//                Integer a = (Integer) o1;
//                Integer b = (Integer) o2;
//
//                return b - a;
//            }
//        });
        //或者额外写一个比较类
//        Arrays.sort(arr, new A());
//        for (Integer x: arr) {
//            System.out.println(x);
//        }
//    }
        //对数值大于long的数加减
        BigInteger bigInteger = new BigInteger("999999999999999999999999999999999");
        BigInteger bigInteger1 = new BigInteger("1");
        //加减乘除等运算只能通过方法
        BigInteger add = bigInteger.add(bigInteger1);
        System.out.println(add);
        //高精度小数同理
        BigDecimal bigDecimal = new BigDecimal("1.1111111111111111111111111111111111");
        BigDecimal bigDecimal1 = new BigDecimal("2.3");
        //保留小数点后位数的精度BigDecimal.ROUND_CEILING
        BigDecimal bigDecimal2 = bigDecimal.divide(bigDecimal1,BigDecimal.ROUND_CEILING);
        System.out.println(bigDecimal2);

    }
}
//class A implements Comparator<Integer> {
//
//    @Override
//    public int compare(Integer o1, Integer o2) {
//        return o2 - o1;
//    }
//}